package q1.project.core.jpa.config;

import com.querydsl.jpa.impl.JPAQueryFactory;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * QueryDSL 配置类 提供 JPAQueryFactory 用于类型安全的动态查询
 *
 * @author Q1 Team
 * @version 1.0
 */
@Configuration
public class QueryDslConfig {

  @PersistenceContext private EntityManager entityManager;

  /** 创建 JPAQueryFactory Bean */
  @Bean
  public JPAQueryFactory jpaQueryFactory() {
    return new JPAQueryFactory(entityManager);
  }
}
